import Mock from 'mockjs'
import HomeData from './mockData/home'
import UserData from './mockData/user'

// 1、拦截路径 2、请求方式 3、返回的数据
Mock.mock('/api/getData', 'get', {
  code: 200,
  data: {
    name: '张三',
    age: 18
  }
})

Mock.mock('/api/getTestData', 'get', HomeData.getTestData)

Mock.mock('/api/home/getTableData', 'get', HomeData.getTableData)
Mock.mock('/api/home/getCountData', 'get', HomeData.getCountData)
Mock.mock('/api/home/getChartData', 'get', HomeData.getChartData)
// 正则匹配才能取得请求携带的参数
Mock.mock(/\/api\/user\/getUserData/, 'get', UserData.getUserList)
Mock.mock(/\/api\/user\/deleteUser/, 'get', UserData.deleteUser)
Mock.mock(/\/api\/user\/addUser/, 'post', UserData.addUser)
Mock.mock(/\/api\/user\/updateUser/, 'post', UserData.updateUser)
// 登录获取菜单
Mock.mock(/\/api\/user\/login/, 'post', UserData.loginGetMenu)
